home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / GRAPHIC / LINES.H < prev    next >
C/C++ Source or Header  |  1991-12-10  |  4KB  |  126 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Interface to Points, Lines, and MultiLines, objects derived from Graphic.
  25.  */
  26.  
  27. #ifndef lines_h
  28. #define lines_h
  29.  
  30. #include <InterViews/Graphic/base.h>
  31.  
  32. class Point : public Graphic {
  33. public:
  34.     Point();
  35.     Point(Coord x, Coord y, Graphic* gr = nil);
  36.  
  37.     void GetOriginal(Coord&, Coord&);
  38.     virtual void SetBrush(PBrush*);
  39.     virtual PBrush* GetBrush();
  40.  
  41.     virtual Graphic* Copy();
  42.     virtual ClassId GetClassId();
  43.     virtual boolean IsA(ClassId);
  44. protected:
  45.     virtual void getExtent(float&, float&, float&, float&, float&, Graphic*);
  46.     virtual boolean contains(PointObj&, Graphic*);
  47.     virtual boolean intersects(BoxObj&, Graphic*);
  48.     virtual void draw(Canvas*, Graphic*);
  49.  
  50.     virtual boolean read(PFile*);
  51.     virtual boolean write(PFile*);
  52. protected:
  53.     Coord x, y;
  54.     Ref brush;
  55. };
  56.  
  57. class Line : public Graphic {
  58. public:
  59.     Line();
  60.     Line(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr = nil);
  61.  
  62.     virtual void GetOriginal(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  63.     virtual void SetBrush(PBrush*);
  64.     virtual PBrush* GetBrush();
  65.  
  66.     virtual Graphic* Copy();
  67.     virtual ClassId GetClassId();
  68.     virtual boolean IsA(ClassId);
  69. protected:
  70.     virtual void getExtent(float&, float&, float&, float&, float&, Graphic*);
  71.     virtual boolean contains(PointObj&, Graphic*);
  72.     virtual boolean intersects(BoxObj&, Graphic*);
  73.     virtual void draw(Canvas*, Graphic*);
  74.  
  75.     virtual boolean read(PFile*);
  76.     virtual boolean write(PFile*);
  77. protected:
  78.     Coord x0, y0, x1, y1;
  79.     Ref brush;
  80. };
  81.  
  82. class MultiLine : public Graphic {
  83. public:
  84.     MultiLine();
  85.     MultiLine(Coord* x, Coord* y, int count, Graphic* gr = nil);
  86.     ~MultiLine();
  87.  
  88.     virtual void GetOriginal(Coord*& x, Coord*& y, int&);
  89.     virtual int GetOriginal(const Coord*&, const Coord*&);
  90.     virtual void SetBrush(PBrush*);
  91.     virtual PBrush* GetBrush();
  92.     virtual void SetPattern(PPattern*);
  93.     virtual PPattern* GetPattern();
  94.  
  95.     virtual boolean operator == (MultiLine&);
  96.     virtual boolean operator != (MultiLine&);
  97.  
  98.     virtual Graphic* Copy();
  99.     virtual ClassId GetClassId();
  100.     virtual boolean IsA(ClassId);
  101. protected:
  102.     virtual boolean extentCached();
  103.     void cacheExtent(float, float, float, float, float);
  104.     virtual void uncacheExtent();
  105.     void getCachedExtent(float&, float&, float&, float&, float&);
  106.     virtual void getExtent(float&, float&, float&, float&, float&, Graphic*);
  107.     virtual boolean contains(PointObj&, Graphic*);
  108.     virtual boolean intersects(BoxObj&, Graphic*);
  109.     void virtual draw(Canvas*, Graphic*);
  110.  
  111.     virtual void pat(Ref);
  112.     virtual Ref pat();
  113.     virtual void br(Ref);
  114.     virtual Ref br();
  115.  
  116.     virtual boolean read(PFile*);
  117.     virtual boolean write(PFile*);
  118. protected:
  119.     Ref _patbr;
  120.     Coord* x, *y;
  121.     int count;
  122.     Extent* extent;
  123. };
  124.  
  125. #endif
  126.